import { defineConfig } from 'vite'
import uni from '@dcloudio/vite-plugin-uni'
import path from 'path'
import vueJsx from '@vitejs/plugin-vue-jsx'
export default defineConfig({
  plugins: [uni(), vueJsx({})],
  resolve: {
    extensions: ['.js', '.jsx', '.ts', '.tsx', '.json', '.vue'],
    alias: {
      '#': path.resolve(__dirname, 'types'),
    },
  },
  server: {
    open: true,
    proxy: {
      '/dev-api': {
        target: 'https://jjr.hghc.top/prod-api', // 本地环境-崔中权
        changeOrigin: true,
        rewrite: (p) => p.replace(/^\/dev-api/, ''),
      },
    },
  },
  css: {
    preprocessorOptions: {
      scss: {
        api: 'modern-compiler',
        silenceDeprecations: ['legacy-js-api'],
      },
    },
  },
})
